package com.atguigu.gmall.product.controller;


import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.service.ManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "分布式文件上传接口")
@RestController
@RequestMapping("admin/product")
//@CrossOrigin
@RefreshScope //自动刷新配置
public class FileUploadController {

    @Autowired
    private ManageService manageService;

    @ApiOperation("Minio文件上传")
    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file){
       String url= manageService.fileUpload(file);
        System.out.println("url:"+url);
       return Result.ok(url);
    }
}
